<?php /* Smarty version 2.6.20, created on 2016-07-27 12:03:04
         compiled from ./products/modify.php */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('block', 'products', './products/modify.php', 5, false),array('block', 'shops', './products/modify.php', 8, false),array('modifier', 'default', './products/modify.php', 39, false),array('function', 'math', './products/modify.php', 68, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "admin/top.php", 'smarty_include_vars' => array('subject' => 'products')));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "products/top.php", 'smarty_include_vars' => array('subject' => 'products')));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<div id="content">
  <form method="post">
  <?php $this->_tag_stack[] = array('products', array('limit' => 1,'id' => $this->_tpl_vars['segment']['id'])); $_block_repeat=true;smarty_block_products($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?>
    <table width="100%" border="0" cellpadding="5" cellspacing="0" id="editor">
        <?php if (0): ?><tr>
        <td class="title">产品供应商:<br/><br/><select onchange="$('[shopid]').hide();$('[shopid='+this.value+']').show();"><?php $this->_tag_stack[] = array('shops', array()); $_block_repeat=true;smarty_block_shops($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);while ($_block_repeat) { ob_start(); ?><option value="<?php echo $this->_tpl_vars['shops']['id']; ?>
" <?php if ($this->_tpl_vars['shops']['id'] == $this->_tpl_vars['products']['shopid']): ?>selected<?php endif; ?> <?php if (1 == $this->_tpl_vars['shops']['disabled']): ?>disabled<?php endif; ?>><?php echo $this->_tpl_vars['shops']['title']; ?>
</option><?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_shops($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?></select></td>
        <td class="content">
<!--         <select name="classid"> -->
<!--         <option value="0">未指定</option> -->
<!--         <?php $_from = $this->_tpl_vars['myclasses']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
?> -->
<!--         <option value="<?php echo $this->_tpl_vars['item']['id']; ?>
" priceline="<?php echo $this->_tpl_vars['item']['priceline']; ?>
" priceunderline="<?php echo $this->_tpl_vars['item']['priceunderline']; ?>
" <?php if ($this->_tpl_vars['item']['id'] == $this->_tpl_vars['products']['classid']): ?>selected<?php endif; ?>> -->
<!--         <?php echo $this->_tpl_vars['item']['title']; ?>
 -->
<!--         </option> -->
<!--         <?php if ($this->_tpl_vars['item']['children']): ?> -->
<!--         <?php $_from = $this->_tpl_vars['item']['children']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['sub_key'] => $this->_tpl_vars['sub_item']):
?> -->
<!--          <option value="<?php echo $this->_tpl_vars['sub_item']['id']; ?>
" priceline="<?php echo $this->_tpl_vars['sub_item']['priceline']; ?>
" priceunderline="<?php echo $this->_tpl_vars['sub_item']['priceunderline']; ?>
" <?php if ($this->_tpl_vars['sub_item']['id'] == $this->_tpl_vars['products']['classid']): ?>selected<?php endif; ?>> -->
<!--         |——<?php echo $this->_tpl_vars['sub_item']['title']; ?>
 -->
<!--         </option> -->
<!--         <?php endforeach; endif; unset($_from); ?> -->
<!--         <?php endif; ?> -->
<!--         <?php endforeach; endif; unset($_from); ?> -->
        
<!--         </select> * -->
        
        	<select name="supplier[]" multiple="multiple" size="10" style="height: auto;">
        		<?php $_from = $this->_tpl_vars['suppliers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['item']):
?>
        			<option value="<?php echo $this->_tpl_vars['item']['id']; ?>
" <?php if (@ in_array ( $this->_tpl_vars['item']['id'] , explode ( "," , $this->_tpl_vars['products']['supplieid'] ) )): ?>selected<?php endif; ?> shopid="<?php echo $this->_tpl_vars['item']['shopid']; ?>
" style="<?php if ($this->_tpl_vars['products']['shopid'] != $this->_tpl_vars['item']['shopid']): ?>display:none;<?php else: ?><?php endif; ?>"><?php echo $this->_tpl_vars['item']['title']; ?>
</option>
        		<?php endforeach; endif; unset($_from); ?>
        	</select>按住ctrl多选
        </td>
        <td class="content"> <?php if ($this->_tpl_vars['errors']['empty_supplier']): ?><span class="warning">请指定供应商</span>
        <?php else: ?>指定供应商
        <?php endif; ?></td>
      </tr><?php endif; ?>
      <tr>
        <td width="100" class="title">产品名称:</td>
        <td width="240" class="content"><input name="title" type="text" id="title" value="<?php echo ((is_array($_tmp=@$_POST['title'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['pname'], 1) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['pname'], 1)); ?>
" size="30" readonly="true"/> *</td>
        <td width="821" class="content">
<!--         <?php if ($this->_tpl_vars['errors']['empty_title']): ?><span class="warning">产品名称不能为空</span> -->
<!--         <?php else: ?> 
        <?php endif; ?>        -->填写产品的名称</td>
      </tr>
      <tr>
        <td class="title">产品规格:</td>
        <td class="content"><input name="spec" type="text" id="spec" value="<?php echo ((is_array($_tmp=@$_POST['spec'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['spec'], 1) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['spec'], 1)); ?>
" size="30"  disabled="true"/></td>
        <td class="content">填写产品规格, 如 50g，200ml等</td>
      </tr>
      <?php if (0): ?><tr>
        <td class="title">采购单价:</td>
        <td class="content">
        	<input name="pricebuy" type="text" id="pricebuy" value="<?php echo ((is_array($_tmp=@$_POST['pricebuy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['pricebuy']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['pricebuy'])); ?>
" size="30" update_price=1/>
        	<select name="currency_unit">
        		<option value="">---请选择---</option>
        		<?php $_from = $this->_tpl_vars['currency_unit_arr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['culist']):
?>
        		<option value="<?php echo $this->_tpl_vars['culist']['unit_en']; ?>
" <?php if ($this->_tpl_vars['products']['currency_unit'] == $this->_tpl_vars['culist']['unit_en']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['culist']['unit_name']; ?>
</option>
        		<?php endforeach; endif; unset($_from); ?>
        	</select>
        	 *
        </td>
        <td class="content"><?php if ($this->_tpl_vars['errors']['empty_pricebuy']): ?><span class="warning">采购单价不能为空</span>
        <?php else: ?>填写采购单价<span class="warning">(请选择正确的货币单位)</span>
        <?php endif; ?> </td>
      </tr><?php endif; ?>
<!--       <tr> -->
<!--         <td class="title">销售底价:</td> -->
<!--         <td class="content" style="width:580px;"><input name="priceundersell" type="text" id="priceundersell" value="<?php echo ((is_array($_tmp=@$_POST['priceundersell'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['priceundersell']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['priceundersell'])); ?>
" size="30" update_price=1/>=采购单价×(1+销售底价底利率<input type="text" id="priceunderline" value="<?php if ($this->_tpl_vars['products']['priceundersell'] == ''): ?>0.00<?php else: ?><?php echo smarty_function_math(array('equation' => 'x/y','x' => $this->_tpl_vars['products']['priceundersell'],'y' => $this->_tpl_vars['products']['pricebuy'],'format' => '%.2f'), $this);?>
<?php endif; ?>" size="10" update_price=1>(%))</td> -->
<!--         <td class="content"><?php if ($this->_tpl_vars['errors']['empty_priceundersell']): ?><span class="warning">销售底价不能为空</span> -->
<!--         <?php else: ?>填写销售底价 -->
<!--         <?php endif; ?> </td> -->
<!--       </tr> -->
<!--       <tr> -->
<!--         <td class="title">销售单价:</td> -->
<!--         <td class="content"><input name="pricesell" type="text" id="pricesell" value="<?php echo ((is_array($_tmp=@$_POST['pricesell'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['pricesell']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['pricesell'])); ?>
" size="30" update_price=1/>=采购单价×&nbsp;&nbsp;&nbsp;(1+销售价底利率<input type="text" id="priceline" value="<?php if ($this->_tpl_vars['products']['pricesell'] == ''): ?>0.00<?php else: ?><?php echo smarty_function_math(array('equation' => 'x/y','x' => $this->_tpl_vars['products']['pricesell'],'y' => $this->_tpl_vars['products']['pricebuy'],'format' => '%.2f'), $this);?>
<?php endif; ?>" size="10" update_price=1>(%))</td> -->
<!--         <td class="content"><?php if ($this->_tpl_vars['errors']['empty_pricesell']): ?><span class="warning">销售单价不能为空</span> -->
<!--         <?php else: ?>填写销售单价 -->
<!--         <?php endif; ?> </td> -->
<!--       </tr> -->
      <tr>
        <td class="title">库存单位:</td>
        <td class="content"><input name="unit" type="text" id="unit" value="<?php echo ((is_array($_tmp=@$_POST['unit'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['unit']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['unit'])); ?>
" size="30" /></td>
        <td class="content"><?php if ($this->_tpl_vars['errors']['empty_unit']): ?><span class="warning">库存单位不能为空</span><?php else: ?>库存计算的单位, 如: 个, 箱, 件, 斤等<?php endif; ?></td>
      </tr>
<!--       <tr> -->
<!--         <td class="title">最小出库单位:</td> -->
<!--         <td class="content" style="width:580px;"><input  type="text" name="minnum" value="<?php echo ((is_array($_tmp=@$_POST['minnum'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['minnum']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['minnum'])); ?>
" size="30" /></td> -->
<!--         <td class="content">设置此值后将以此最小单位出库</td> -->
<!--       </tr> -->
<!--       <tr> -->
<!--         <td class="title">最大出库单位:</td> -->
<!--         <td class="content" style="width:580px;"><input  type="text" name="maxnum" value="<?php echo ((is_array($_tmp=@$_POST['maxnum'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['maxnum']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['maxnum'])); ?>
" size="30" /></td> -->
<!--         <td class="content">设置此值后将以此最大单位出库</td> -->
<!--       </tr> -->
      <tr>
        <td class="title">预警数量:</td>
        <td class="content" style="width:580px;"><input  type="text" name="shopwarningnum" value="<?php echo ((is_array($_tmp=@$_POST['shopwarningnum'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['shopwarningnum']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['shopwarningnum'])); ?>
" size="30" /></td>
        <td class="content">该商品的预警数量（默认为 5），如果此商品没有具体的预警数量，则继承父类的预警数量值</td>
      </tr>
      
     
       <tr>
        <td class="title">预售数量:</td>
        <td class="content"><input name="wanttobuy" type="text" id="wanttobuy" value="<?php echo ((is_array($_tmp=@$_POST['wanttobuy'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['wanttobuy']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['wanttobuy'])); ?>
" size="30" /> <input type="checkbox" onclick="setYS(this)" id="setysCheckBox">只销售实际库存</td>
        <td class="content">预售数量，可以初始化虚拟库存</td>
      </tr>
      
        <tr>
        <td class="title">虚拟库存:</td>
        <td class="content"><input name="canbuyout" type="text" id="canbuyout" value="<?php echo ((is_array($_tmp=@$_POST['canbuyout'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['canbuyout']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['canbuyout'])); ?>
" size="30" readonly style="background:#eee;border:1px solid #aaa;"/> <a href="javascript:void(0);" onclick="if(confirm('初始化虚拟库存会影响销售库存情况，确认初始化？'))$('#canbuyout').val($('#wanttobuy').val())">初始化虚拟库存</a></td>
        <td class="content">允许虚拟销售的库存数，如果为负值则此商品为0不显示缺货，库存为负此值或以下时，显示缺货</td>
      </tr>
      <tr>
        <td class="title">实际库存:</td>
        <td class="content"><input name="stocks" type="text" id="stocks" value="<?php echo ((is_array($_tmp=@$_POST['stocks'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['stocks']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['stocks'])); ?>
" readonly size="30" style="background:#eee;border:1px solid #aaa;<?php if ($this->_tpl_vars['products']['stocks'] > 0): ?>color:red;<?php endif; ?>"/></td>
        <td class="content">实际库存数量</td>
      </tr>
<!--       <tr class="noline"> -->
<!--         <td class="title">产品介绍:</td> -->
<!--         <td colspan="2" class="content"><textarea name="intro" cols="100" rows="8" id="intro"><?php echo ((is_array($_tmp=@$_POST['intro'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['intro']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['intro'])); ?>
</textarea></td> -->
<!--       </tr> -->
      <tr>
        <td class="title">是否应用到商品:</td>
        <td class="content"><input name="is_apply_all" type="checkbox" id="is_apply_all" value="1"/> </td>
        <td class="content" style="color: red;">如果勾选，则整个商品（即该SKU所属商品下的所有SKU）都应用以上设置</td>
      </tr>
      <tr class="noline">
      	<td class="title">产品条码数字:</td>
      	<td class="content"><input name="barcode" type="text" id="barcode" value="<?php echo ((is_array($_tmp=@$_POST['barcode'])) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['products']['barcode']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['products']['barcode'])); ?>
" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="13" size="30"/></td>
        <td class="content">
         <?php if ($this->_tpl_vars['errors']['barcode_num']): ?><span class="warning">条码数字必须为13位数字哟</span>
         <?php else: ?>填写产品条码数字, 如 4711161741799等
		<?php endif; ?>
		</td>
      </tr>
    </table>
    
    <div class="fr mt10">
    <input type="submit" value="确定" class="btn" />
    <a href="javascript:window.history.go(-1);" class="btn">取消</a> 
    <input name="id" type="hidden" id="id" value="<?php echo $this->_tpl_vars['products']['id']; ?>
" />
    <input name="referer" type="hidden" id="referer" value="<?php echo ((is_array($_tmp=@$_POST['referer'])) ? $this->_run_mod_handler('default', true, $_tmp, @$_SERVER['HTTP_REFERER'], 1) : smarty_modifier_default($_tmp, @$_SERVER['HTTP_REFERER'], 1)); ?>
" />
    <input name="action" type="hidden" id="action" value="modify" />
    </div>
	<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false;echo smarty_block_products($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat); }  array_pop($this->_tag_stack); ?>
	
  </form>
</div>
<script type="text/javascript">
//<!--<?php echo '

if($(\'#wanttobuy\').val()==0){
	$(\'#wanttobuy\').attr(\'readonly\',\'readonly\').css({background:\'#eee\',border:\'1px solid #aaa\'});
	$(\'#setysCheckBox\').attr(\'checked\',\'checked\');
}


function setYS(o){
	var $$=$(o);
	if($$.is(\':checked\')){
		if(confirm(\'只销售库存会清除虚拟库存和预售数量，确认？\')){
			$(\'#wanttobuy\').val(\'0\').attr(\'readonly\',\'readonly\').css({background:\'#eee\',border:\'1px solid #aaa\'});$(\'#canbuyout\').val(\'0\');
		}

	}else{

		$(\'#wanttobuy\').removeAttr(\'readonly\').css({background:\'\',border:\'\'});


		}


	}


//'; ?>
-->
</script>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "admin/bottom.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
</body>
</html>